<?php
/*
 * @Descripttion: 
 * @version: 1.0
 * @Author: Sam
 * @Date: 2022-04-21 15:27:09
 * @LastEditors: Sam
 * @LastEditTime: 2022-05-05 01:17:51
 */
use app\admin\model\AuthRule as AuthRuleModel;
if (!AuthRuleModel::where('title', '集卡管理')->count()) {

    $parent_id = AuthRuleModel::query()->create([
        'parent_id'    => 0,
        'title'        => '集卡管理',
        'url'          => '#',
        'method'       => 'OPTIONS',
        'slug'         => 'card'
    ]);
   $parent_id_1 =   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '卡片列表',
        'url'          => 'card_index',
        'method'       => 'GET',
        'slug'         => 'card.index'
    ]);
    $parent_id_2 =   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id->id,
        'title'        => '抽卡记录',
        'url'          => 'card_log',
        'method'       => 'GET',
        'slug'         => 'card.card_log'
    ]);
   AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_2->id,
        'title'        => '抽卡记录导出',
        'url'          => 'card_log_export',
        'method'       => 'GET',
        'slug'         => 'card.card_log_export'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '添加',
        'url'          => 'card_create',
        'method'       => 'POST',
        'slug'         => 'card.create'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '编辑卡片',
        'url'          => 'card_edit',
        'method'       => 'POST',
        'slug'         => 'card.edit'
    ]);
    AuthRuleModel::query()->create([
        'parent_id'    => $parent_id_1->id,
        'title'        => '删除卡片',
        'url'          => 'card_delete',
        'method'       => 'POST',
        'slug'         => 'card.delete'
    ]);
}

